package com.suzhe.ymall.pay.timer;

import com.suzhe.ymall.pay.service.IPayRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author suzhe
 * @date 2019/8/13
 */
@Slf4j
@Component //使spring管理
@EnableScheduling //定时任务注解
public class Timer {
    @Autowired
    IPayRecordService iPayRecordService;

    @Scheduled(cron = "0/10 * * * * ?")
    public void notifyOrder(){
        log.info("timer notifyOrder ....");
        try {
            iPayRecordService.notifyOrder();
        }catch (Exception e){
            log.error("notifyOrder error:",e);
        }

    }


}
